package org.example.myerp.service.serviceimpl;

import org.example.myerp.mapper.productDesign.productArchiveManagement.ProductFilesMapper;
import org.example.myerp.pojo.*;
import org.example.myerp.service.ProInfoAssetService;
import org.example.myerp.service.ProInformationService;
import org.example.myerp.service.ProductFilesService;
import org.example.myerp.until.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.sql.Array;
import java.util.ArrayList;
import java.util.Collections;

/**
 * ��Ʒ��������Ƶ���������ҵ��㡿ʵ����
 *
 * @author DELL
 */
@Service
public class ProductFilesServiceImpl implements ProductFilesService {
    @Autowired
    //��Ʒ������
    ProductFilesMapper productFilesMapper;
    @Autowired
    // ��Ʒ��������Ϣ��ҵ��㡿
    ProInformationService proInformationService;
    @Autowired
    // ��Ʒ��������Ϣ��ҵ��㡿
    ProInfoAssetService proInfoAssetService;

    @Autowired
    RedisUtil redisUtil;
    @Autowired
    RedisTemplate redisTemplate;
    //

    /**
     * ��Ӳ�Ʒ������Ƶ���Ϣ
     */
    @Override
    public Integer getInsertProductFilesMessage(ProductFiles productFiles) {
        Integer row = productFilesMapper.insertProductFilesMessage(productFiles);
        return row;
    }

    @Override
    public Integer getUpdateProductFilesByPId(ProInformation proInformation, ProInfoAsset proInfoAsset) {
        redisUtil.del("makeHouse"+"*");
        Integer row;
        row = proInformationService.getUpdateProInformationByProInformationAll(proInformation);
        row += proInfoAssetService.getUpdateProInfoAssetByProInfoAssetAll(proInfoAsset);
        return row;
    }

    @Override
    public Integer getSelectProSigeIdByPid(Integer pid) {
        Integer proSigeId = productFilesMapper.selectProSigeIdByPid(pid);
        return proSigeId;
    }

    /**
     * ���ƶ����������Ƶ��ɹ������޸Ĳ�Ʒ�����Ƶ��ֶ�WuliSigin�����������ơ� = �����
     */
    @Override
    public Integer getUpdateProductFileWuLiaoSiginByProSigeId(Integer ProSigeId) {
        Integer row = productFilesMapper.updateProductFileWuLiaoSiginByProSigeId(ProSigeId);
        return row;
    }

    /**
     * ��ʼ��д���޸���Ƶ��Ĳ�Ʒ�����˱�־�ֶΡ�
     */
    @Override
    public Integer getUpdateProductFilesByPId(Integer pId) {
        Integer row = productFilesMapper.updateProductFilesByPId(pId);
        return row;
    }
}
